import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:numbergame/src/colors.dart';

Widget myText(String data, {double size = 72.0}) {
  return Text(
    data,
    textAlign: TextAlign.center,
    style: TextStyle(
      color: Color.fromARGB(255, 48, 157, 128),
      fontSize: size,
      fontFamily: 'kuaile',
    ),
  );
}

Widget customButton(
    {Key key,
    VoidCallback onPress,
    String text = "Enter your Text",
    Color color = Colors.transparent}) {
  return Container(
    margin: EdgeInsets.all(10),
    child: TextButton(
      onPressed: onPress,
      style: ButtonStyle(
          backgroundColor: MaterialStateProperty.resolveWith((states) {
        if (states.contains(MaterialState.pressed)) {
          return MyColors.blue[900];
        } else if (states.contains(MaterialState.hovered)) {
          return MyColors.blue[600];
        } else {
          return MyColors.blue;
        }
      })),
      child: Container(
        margin: EdgeInsets.all(10),
        child: Text(
          text,
          style: TextStyle(
            color: MyColors.blue[100],
            fontSize: 20,
            fontFamily: 'kuaile',
          ),
        ),
      ),
    ),
  );
}

Widget gameButton(
    {VoidCallback onPress,
    String text = "Enter your Text",
    Color splashColor = Colors.transparent,
    Color color,
    bool isPressed = false}) {
  Color btnColor = isPressed ? color : Color.fromARGB(255, 255, 255, 255);

  return Container(
    margin: EdgeInsets.all(10),
    child: Neumorphic(
      style: NeumorphicStyle(
        shape: NeumorphicShape.flat,
        boxShape: NeumorphicBoxShape.roundRect(BorderRadius.circular(12)),
        depth: 3,
        intensity: 0.75,
        lightSource: LightSource.topLeft,
        color: btnColor,
      ),
      child: TextButton(
        onPressed: onPress,
        style: ButtonStyle(
            overlayColor: MaterialStateProperty.resolveWith((states) {
          if (states.contains(MaterialState.pressed)) {
            return splashColor;
          } else {
            return null;
          }
        })),
        child: Text(
          text,
          textAlign: TextAlign.center,
          style: TextStyle(
            color: MyColors.blue,
            fontSize: 39,
            fontFamily: 'kuaile',
          ),
        ),
      ),
    ),
  );
}
